home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Code Helpe270499272001.psc / Code Helper 2001 / frmSearch.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-09-21  |  5.7 KB  |  210 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSearch 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Search"
  5.    ClientHeight    =   3495
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4950
  9.    Icon            =   "frmSearch.frx":0000
  10.    LinkTopic       =   "Form2"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3495
  14.    ScaleWidth      =   4950
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.Frame Frame1 
  18.       Caption         =   "Results:"
  19.       Enabled         =   0   'False
  20.       Height          =   2175
  21.       Left            =   120
  22.       TabIndex        =   5
  23.       Top             =   1200
  24.       Width           =   4695
  25.       Begin VB.CommandButton cmdCopy 
  26.          Caption         =   "&Copy List"
  27.          Height          =   375
  28.          Left            =   3360
  29.          TabIndex        =   8
  30.          Top             =   840
  31.          Width           =   1215
  32.       End
  33.       Begin VB.CommandButton cmdView 
  34.          Caption         =   "&View"
  35.          Height          =   375
  36.          Left            =   3360
  37.          TabIndex        =   7
  38.          Top             =   360
  39.          Width           =   1215
  40.       End
  41.       Begin VB.ListBox List1 
  42.          Height          =   1620
  43.          IntegralHeight  =   0   'False
  44.          Left            =   120
  45.          TabIndex        =   6
  46.          Top             =   360
  47.          Width           =   3135
  48.       End
  49.    End
  50.    Begin VB.CommandButton cmdCancel 
  51.       Caption         =   "Cancel"
  52.       Height          =   375
  53.       Left            =   3600
  54.       TabIndex        =   4
  55.       Top             =   600
  56.       Width           =   1215
  57.    End
  58.    Begin VB.CommandButton cmdSearch 
  59.       Caption         =   "Search"
  60.       Default         =   -1  'True
  61.       Height          =   375
  62.       Left            =   3600
  63.       TabIndex        =   3
  64.       Top             =   120
  65.       Width           =   1215
  66.    End
  67.    Begin VB.CheckBox MC 
  68.       Caption         =   "&Match Case"
  69.       Height          =   255
  70.       Left            =   120
  71.       TabIndex        =   2
  72.       Top             =   600
  73.       Width           =   3255
  74.    End
  75.    Begin VB.ComboBox Combo1 
  76.       Height          =   315
  77.       Left            =   1440
  78.       TabIndex        =   1
  79.       Top             =   120
  80.       Width           =   2055
  81.    End
  82.    Begin VB.Label Label1 
  83.       Caption         =   "&Search keyword:"
  84.       Height          =   255
  85.       Left            =   120
  86.       TabIndex        =   0
  87.       Top             =   150
  88.       Width           =   1215
  89.    End
  90. Attribute VB_Name = "frmSearch"
  91. Attribute VB_GlobalNameSpace = False
  92. Attribute VB_Creatable = False
  93. Attribute VB_PredeclaredId = True
  94. Attribute VB_Exposed = False
  95. Private Const MinHeight = 1440
  96. Private Const MaxHeight = 3870
  97. Private CodeIndex() As Integer
  98. Private Sub Check1_GotFocus()
  99. cmdSearch.Default = True
  100. End Sub
  101. Private Sub cmdCancel_Click()
  102. Unload Me
  103. End Sub
  104. Private Sub cmdCopy_Click()
  105. Dim Stg As String, i As Integer
  106. For i = 0 To List1.ListCount - 1
  107.     If i <> 0 Then Stg = Stg & vbCrLf
  108.     Stg = Stg & List1.List(i)
  109. Next i
  110. If Stg <> "" Then
  111.     Clipboard.Clear
  112.     Clipboard.SetText Stg
  113. End If
  114. End Sub
  115. Private Sub cmdSearch_Click()
  116. Dim i As Integer, j As Integer, MyCount As Integer
  117. If Combo1.Text = "" Then
  118.     Beep
  119.     MsgBox "You have to type a keyword!", vbInformation, "Info!"
  120.     Exit Sub
  121. End If
  122. Me.Frame1.Enabled = True
  123. 'DoSearch
  124. Combo1.Locked = True
  125. List1.Clear
  126. For i = 0 To Form1.List1.ListCount - 1
  127.     If MC.Value = 0 Then
  128.         For j = 0 To UBound(MyCode(i).SearchTags)
  129.             If LCase(Combo1.Text) = LCase(MyCode(i).SearchTags(j)) Then
  130.                 List1.AddItem MyCode(i).EntryName
  131.                 ReDim Preserve CodeIndex(MyCount)
  132.                 CodeIndex(MyCount) = i
  133.                 MyCount = MyCount + 1
  134.             End If
  135.         Next j
  136.     Else
  137.         For j = 0 To UBound(MyCode(i).SearchTags)
  138.             If Combo1.Text = MyCode(i).SearchTags(j) Then
  139.                 List1.AddItem MyCode(i).EntryName
  140.                 ReDim Preserve CodeIndex(MyCount)
  141.                 CodeIndex(MyCount) = i
  142.                 MyCount = MyCount + 1
  143.             End If
  144.         Next j
  145.     End If
  146.     DoEvents
  147. Next i
  148. 'End Search
  149. Me.Height = MaxHeight
  150. If List1.ListCount = 0 Then
  151.     cmdCopy.Enabled = False
  152.     cmdView.Enabled = False
  153.     cmdCopy.Enabled = True
  154.     cmdView.Enabled = True
  155. End If
  156. For j = 1 To OldSearches.count
  157.     If Combo1.Text = OldSearches(j) Then
  158.         GoTo XS
  159.     End If
  160. Next j
  161. OldSearches.Add Combo1.Text
  162. AddSearches
  163. Combo1.Locked = False
  164. End Sub
  165. Private Sub cmdView_Click()
  166. 'Dim A As Long, H As Long
  167. InfoBox = False
  168. Load frmView
  169. frmView.Text1.Text = MyCode(CodeIndex(List1.ListIndex)).EntryValue
  170. ColorBox frmView.Text1
  171. frmView.Show 1
  172. 'OpenNotePad
  173. 'DoEvents
  174. 'Sleep 100
  175. 'A = GetActiveWindow
  176. 'Sleep 500
  177. 'Beep
  178. 'H = GetWindowDC(A)
  179. 'SendText A, MyCode(CodeIndex(List1.ListIndex)).EntryValue
  180. End Sub
  181. Private Sub Combo1_GotFocus()
  182. Combo1.SelStart = 0
  183. Combo1.SelLength = Len(Combo1.Text)
  184. cmdSearch.Default = True
  185. End Sub
  186. Private Sub Form_Load()
  187. Me.Height = MinHeight
  188. AddSearches
  189. End Sub
  190. Private Sub Form_Unload(Cancel As Integer)
  191. SetActiveWindow Form1.hwnd
  192. End Sub
  193. Private Sub Label1_Click()
  194. Combo1.SetFocus
  195. End Sub
  196. Private Sub List1_GotFocus()
  197. cmdView.Default = True
  198. End Sub
  199. Sub AddSearches()
  200. Dim i As Integer, Stg As String
  201. Stg = Combo1.Text
  202. Combo1.Clear
  203. If OldSearches.count > 0 Then
  204.     For i = 0 To OldSearches.count - 1
  205.         Combo1.AddItem OldSearches(i + 1)
  206.     Next i
  207. End If
  208. Combo1.Text = Stg
  209. End Sub
  210.